IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_MasterEventLogType_SrvrInstncDatabase]') AND parent_object_id = OBJECT_ID(N'[dbo].[MasterEventLogType]'))
BEGIN
     ALTER TABLE [dbo].[MasterEventLogType] DROP CONSTRAINT [FK_MasterEventLogType_SrvrInstncDatabase]
END
GO

ALTER TABLE [dbo].[MasterEventLogType] WITH CHECK ADD CONSTRAINT [FK_MasterEventLogType_SrvrInstncDatabase] 
     FOREIGN KEY([SrvrInstncDatabaseId]) REFERENCES [dbo].[SrvrInstncDatabase] ([SrvrInstncDatabaseId])
GO
